package com.solcoo.controller;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.solcoo.pojo.RechargeInfo;
import com.solcoo.service.RechargeService;

@Controller
public class RechargeController extends AbstractController{

    @Resource
    private RechargeService rechargetService;

    public void setRechargetService(RechargeService rechargetService) {
        this.rechargetService = rechargetService;
    }

    @RequestMapping(value="addRecharge.do")
    public @ResponseBody JsonResult addRecharge(RechargeInfo rechargeInfo) throws Exception {
        rechargetService.addRechargeInfo(rechargeInfo);
        return this.getSuccessJsonResult("增加活动成功");
    }

    @RequestMapping(value="queryRecharge.do")
    public @ResponseBody JsonResult2 queryRecharge(String merchantId) throws Exception {
        List<RechargeInfo> ris = rechargetService.selectRechargeInfo(merchantId);
        return this.getSuccessJsonResult2(ris);
    }

    @RequestMapping(value="deleteRecharge.do")
    public @ResponseBody JsonResult deleteRecharge(int id) throws Exception {
        rechargetService.deleteRechargeInfo(id);
        return this.getSuccessJsonResult("删除活动成功");
    }
}
